<template>
  <div class="count">
    <h2>Count组件</h2>
    <!--    <button @click="$emit('click')">调用自定义事件</button>-->
    <!--    <button @click="$emit('click',2)">调用自定义事件并传一个参数</button>-->
    <button @click="$emit('click',2,4)">调用自定义事件并传多个参数</button>
  </div>
</template>

<script lang="ts">
import {defineComponent} from "vue";

export default defineComponent({
  name: "Count",
});

</script>

<script lang="ts" setup>
// 接受自定义事件
defineEmits<{
  (event: 'click', n: number, m: number): void;
}>()
</script>

<style scoped>
.count {
  background-color: skyblue;
}
</style>